package framework;

/**
 * This class models an order item. It contains the following information:
 * <ol>
 * <li>the quantity of the order item, an <code>int</code></li>
 * <li>the type of the order item, a <code>Product</code></li>
 * </ol>
 *
 */

public class OrderItem {
	/**
	 * The quantity of the product in the order item.
	 */
	private int quantity = 0;
	
	/**
	 * The type of the order item.
	 */
	private Product product;
	
	/**
	 * Construct a <code>OrderItem</code> object.
	 * @param initialQuantity the quantity of the product in the order item.
	 * @param initialProduct the product in the order item.
	 */
	public OrderItem(int initialQuantity, Product initialProduct) {
		quantity = initialQuantity;
		product = initialProduct;
	}
	
	/**
	 * Get the quantity of the product in the order item.
	 * @return the quantity of the product in the order item
	 */
	public int getQuantity() {
		return quantity;
	}
	
	/**
	 * Set a new quantity for the product in the order item.
	 * @param newQuantity the new quantity of the product in the order item
	 */
	public void setQuantity(int newQuantity) {
		quantity = newQuantity;
	}
	
	/**
	 * Get the product in the order item.
	 * @return the product in the order item
	 */
	public Product getProduct() {
		return product;
	}
   /**
     *show  the quantity of the product and all info of the product
     */
    public String toString() {
		return quantity +"_"+ product.toString();
	}
}
